package com.k.configcenter.hello;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author k
 */
@Controller
public class IndexController {
    @Value("${spring.application.name}")
    private String appName;
    @Value("${server.port}")
    private Integer port;
    @RequestMapping("/")
    @ResponseBody
    public Map<String,Object> index(){
        Map<String,Object> ret = new HashMap<>();
        ret.put(""+port,appName);
        return ret;
    }
    @RequestMapping("/test")
    @ResponseBody
    public Map<String,Object> test(){
        Map<String,Object> ret = new HashMap<>();
        ret.put(""+port,appName);
        ret.put("/test","test");
        return ret;
    }

}
